﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using VISTA;

namespace VISTA
{
    static class Program
    {
        /// <summary>
        /// Punto de entrada principal para la aplicación.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var frm = new VISTA.frmPrincipal();
            frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
            Application.Run(frm);

            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
            Application.ThreadExit += new EventHandler(Application_ThreadExit);

        }

        static void frm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Sesion.Logout();
        }

        static void Application_ThreadExit(object sender, EventArgs e)
        {
            Sesion.Logout();
        }

        static void Application_ApplicationExit(object sender, EventArgs e)
        {
            Sesion.Logout();
        }
    }
}